import React, { useEffect, useState } from 'react'
import { View, Input } from '@tarojs/components'
import Taro from '@tarojs/taro'
import { getDom } from '@/utils/utils'
import './index.scss'
const DropdownMenu = (props) => {
    const { children, visible, selectList = [], onClose } = props
    const [top, setTop] = useState(0)
    useEffect(() => {
        setTimeout(() => {
            try {
                getDom('.PublicSettingDrawer_up_findIndex', (e) => {
                    setTop(e[0].top)
                })
            } catch (e) {
                setTop(84)
            }

        }, 1000)

    }, [selectList])

    return <View className='DropdownMenu_box'>
        <View className='DropdownMenu_getTop'></View>
        <View className='DropdownMenu_top'>
            <View className={`selectWrap ${visible ? 'slidown' : 'slidup'}`}>
                {children}
            </View>
            <View style={{ top: top }} className={visible ? 'shadow' : ''} onClick={() => {
                onClose()
            }} />

        </View>
    </View>
}
export default DropdownMenu